package com.rbac.mapper;

import com.baomidou.mybatisplus.core.mapper.BaseMapper;
import com.rbac.pojo.Permission;
import org.apache.ibatis.annotations.*;

import java.util.List;

@Mapper
public interface PermissionMapper extends BaseMapper<Permission> {
    @Insert("insert into role_permission (role_id, permission_id) values (#{roleId}, #{permissionId})")
    Integer addRolePermission(@Param(("permissionId")) Integer permissionId,@Param("roleId") Integer roleId);

    @Select("select role_id from role_permission where permission_id = #{permissionId}")
    List<String> queryRolePermissionByPermissionId(Integer permissionId);

    @Delete("delete from role_permission where permission_id = #{permissionId}")
    Integer removeRolePermission(Integer permissionId);
}
